//
//  PictureCollectionViewCell.swift
//  Gaoloumi
//
//  Created by Jasper on 4/16/16.
//  Copyright © 2016 Jasper. All rights reserved.
//

import UIKit
import Kingfisher 

class PictureCollectionViewCell: UICollectionViewCell {
    
    
    @IBOutlet weak var pictureImgView: UIImageView!
    
    func refreshView(_ picture: Picture) {
        let intWidth = Int((UIScreen.main.bounds.width - 42)/3)*2
        let urlstr = picture.file?.url
        let urlCon = "\(urlstr!)?imageView/1/w/\(intWidth)/h/\(intWidth)"
//        print(urlCon)
        let url = URL(string: urlCon)
        pictureImgView?.kf.setImage(with: url,
                               placeholder: DataCenter.sharedInstance.placeholderImage,
                               options: nil,
                               progressBlock: { receivedSize, totalSize in
                                
            },
                               completionHandler: { image, error, cacheType, imageURL in
                                
        })
    }
    
    
}
